<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>B2C商城</title>
</head>
<body>
	<%@ include file="/web/front/title/start.jsp"%>
	
	<div class="banner_y center">
	
		<div class="nav" style="float: left">
			<ul id="fenlei2"></ul>
		</div>

		<div class="layui-carousel" id="carousel"
			style="float: left; min-width: 980px; min-height: 470px;">
			<div carousel-item="">
				<div>
					<img src="../base/image/yys_sel1.jpg"
						style="width: 980px; height: 470px;">
				</div>
				<div>
					<img src="../base/image/yys_sel2.jpg"
						style="width: 980px; height: 470px;">
				</div>
				<div>
					<img src="../base/image/yys_n1.png"
						style="width: 980px; height: 470px;">
				</div>
				<div>
					<img src="../base/image/yys_sel4.jpg"
						style="width: 980px; height: 470px;">
				</div>
				<div>
					<img src="../base/image/yys_sel5.jpg"
						style="width: 980px; height: 470px;">
				</div>
				<div>
					<img src="../base/image/yys_sel6.jpg"
						style="width: 980px; height: 470px;">
				</div>
			</div>
		</div>
	</div>	
	<!-- end banner -->

	<!-- start danpin -->

		<div class="danpin center">
			<div class="biaoti center">店家强烈推荐</div>
			<div class="main center">
				<div class="mingxing fl">
					<div class="sub_mingxing"><a href=""><img src="../base/image/鬼王酒吞童子.png" alt=""></a></div>
					<div class="pinpai"><a href="">鬼王酒吞童子</a></div>
					<div class="youhui">大江山鬼王，王者风范尽显</div>
					<div class="jiage">777元起</div>
				</div>
				<div class="mingxing fl">
					<div class="sub_mingxing"><a href=""><img src="../base/image/麓铭大岳丸.png" alt=""></a></div>
					<div class="pinpai"><a href="">麓铭大岳丸</a></div>
					<div class="youhui">麓海归来，君临铃鹿山</div>
					<div class="jiage">1089元</div>
				</div>
				<div class="mingxing fl">
					<div class="sub_mingxing"><a href=""><img src="../base/image/烬天玉藻前1.png" alt=""></a></div>
					<div class="pinpai"><a href="">烬天玉藻前</a></div>
					<div class="youhui">平安京第一鬼王，绝代风华</div>
					<div class="jiage">1299元</div>
				</div>
				<div class="mingxing fl"> 	
					<div class="sub_mingxing"><a href=""><img src="../base/image/骁浪荒川之主.png" alt=""></a></div>
					<div class="pinpai"><a href="">骁浪荒川之主</a></div>
					<div class="youhui">荒川之海王者，一人可抵千军</div>
					<div class="jiage">699元</div>
				</div>
				<div class="mingxing fl">
					<div class="sub_mingxing"><a href=""><img src="../base/image/荒1.png" alt=""></a></div>
					<div class="pinpai"><a href="">荒</a></div>
					<div class="youhui">平安京男模，帅是一辈子的事</div>
					<div class="jiage">999元起</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>

	<%@ include file="/web/front/title/end.jsp"%>

<script type="text/javascript">

	var t = 0;
	
	//轮播渲染
	layui.use('carousel', function() { //模块名,方法
		var carousel = layui.carousel; //获取模块对象
		//render=渲染
		carousel.render({
			elem: "#carousel",
			anim:"fade"
		})
	})
	
	//跳转到该分类界面
	function fenlei(code,i){
		toJsp('/web/front/list.jsp?code'+ i +'=' + code)
	}

	
	//在前端分类回显
	ajax({parentCode:'type1'},'/cate/getAll.do','json',fenleishow)
	function fenleishow(data){
		var html1 = '';
		var html2 = '';
		$.each(data,function(i,dom){
			var code = dom.code;
			if(code == 'type1')return;	
			var t1 = "<li><a href='javascript:fenlei(\"" + code + "\",1)'>" + dom.name + "</a>"
			var t2 = "<div class='pop' id='div_" + code + "'>"
						+"<div class='left fl'></div>"
					+"<div class='ctn fl'></div><div class='right fl'></div></div>"
			html1+=t1+"</li>";
			html2+=t1+t2+"</li>";
		});
		$("#fenlei1").html(html1);
		$("#fenlei2").html(html2);
		$.each(data,function(i,dom){
			var code = dom.code;
			if(code == 'type1')return;	
			ajax({parentCode:dom.code},'/cate/getAll.do','json',function(data){
				$.each(data, function(i, dom) {
					fenleishow2(i/6,dom,code);
				});
			})
		});		
	}
	function fenleishow2(i,dom,parentCode){
		t++;
		if(t>10)
			t=1;
		var code = dom.code;
		var h1 = "<div class='img fl'><img class='imgicon' src='" + base.app + "/web/base/image/yysq"+ t +".png'></div>"
				 +"<span class='fl'>" + dom.name + "</span>"
				 +"<div class='clear'></div>";
		
		var html = "<a href='javascript:fenlei(\"" + code + "\",2);'>" + h1 + "</a>"
		var temp = "<div><div class='xuangou_left fl'>" + html + "</div>"
					+"<div class='xuangou_right fr'><a href='javascript:fenlei(\"" + code + "\",2);'>选购</a></div>"
					+"<div class='clear'></div></div>"
		if(i<1){
			$("#div_"+parentCode+" div[class='left fl']").append(temp)
		}else if(i<2){
			$("#div_"+parentCode+" div[class='ctn fl']").append(temp)
		}else if(i<3){
			$("#div_"+parentCode+" div[class='right fl']").append(temp)
		}
	}
	</script>

</body>
</html>